s{extend name="layout/detail" /}
{block name="content"}
<input id="ajax" value="1" type="hidden">
<div class="layui-tab td-tab-1 no-margin">
    <ul class="layui-tab-title">
        <li onclick="index();">系统设置</li>
        <li onclick="email()">邮件设置</li>
        <li onclick="qiniu()">七牛云</li>
        <li class="layui-this" onclick="weixin()">微信公众号设置</li>
    </ul>
</div>
<div class="td-content-wrap">
    <div class="space-20"></div>
    <form id="form_data" class="layui-form" method="post" >
        <input type="hidden" name="data_type" value="weixin">
        <div class="layui-form-item">
            <label class="layui-form-label">app_id：</label>
            <div class="layui-input-block w40">
                <input type="text" class="layui-input" id="weixin_app_id" name="weixin_app_id" check="required"
                       info="app_id"
                       value="{$system_data.wexin_app_id|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">secret：</label>
            <div class="layui-input-block w40">
                <input type="text" class="layui-input" id="weixin_app_secret" name="weixin_app_secret" check="required"
                       info="secret"
                       value="{$system_data.weixin_app_secret|default=''}">
            </div>
        </div>
        <hr>
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                <a class="layui-btn" lay-submit="" lay-filter="demo2" onclick="save();">保存</a>
                <a class="layui-btn layui-btn-primary" onclick="go_return_url();">取消</a>
            </div>
        </div>
    </form>
</div>
{/block}

{block name="script"}
<script>
    layui.use(['element'], function () {
        set_return_url(null);
        var fn = {
            index: function () {
                window.open('{:url("SystemConfig/index")}', '_self');
            },
            email: function () {
                window.open('{:url("SystemConfig/email")}', '_self');
            },
            qiniu: function () {
                window.open('{:url("SystemConfig/qiniu")}', '_self');
            },
            wechat: function () {
                window.open('{:url("SystemConfig/wechat")}', '_self');
            },
            save: function () {
                send_form("form_data", "{:url('save')}",  function (ret) {
                    if (ret.code) {
                        layer.msg(ret.msg, {
                            time: 1200
                        }, function () {
                            location.reload(true);
                        });
                    } else {
                        layer.msg(ret.msg);
                        return false;
                    }
                });
            }
        };
        win_exp(fn);
    });
</script>
{/block}